<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>借阅证管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
        function selectRow(id) {
            $("#"+id).attr('checked', 'true');
        }
        function query(i) {
		    var actionValue=$("searchForm").attr("action");
		    var cardIdValue=$("cardId").val();
		    var cardStuIdValue=$("cardStuId").val();
            if(i==0){
                actionValue=actionValue+"/cardId="+cardIdValue;
            }
            if(i==1){
                actionValue=actionValue+"/cardStuId="+cardStuIdValue;
            }
        }
	</script>
</head>
<body>
	<form:form id="searchForm" modelAttribute="baseCard" action="${ctx}/base/card/baseCard/selectCardList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>借阅证号：</label>
				<form:input path="cardId" htmlEscape="false" maxlength="20" class="input-medium" onchange="query(0)"/>
			</li>
			<li><label>学号：</label>
				<form:input path="cardStuId" htmlEscape="false" maxlength="20" class="input-medium" onchange="query(1)"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
                <th style="text-align:center;">选择</th>
				<th>借阅证号</th>
				<th>学号</th>
				<th>姓名</th>
				<th>可借阅数</th>
				<th>已借阅数</th>
				<th>备注</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="baseCard">
			<tr onclick="selectRow('${baseCard.id}')">
                <td style="text-align:center;">
                    <input type="radio" name="id" id="${baseCard.id}" value="${baseCard.id}" outCardId="${baseCard.cardId}"
                           outReaderId="${baseCard.cardStuId}" outReaderName="${baseCard.baseReader.readerName}"
                    />
                </td>
				<td>
					${baseCard.cardId}
				</a></td>
				<td>
					${baseCard.cardStuId}
				</td>
                <td>
                    ${baseCard.baseReader.readerName}
                </td>
				<td>
					${baseCard.cardBorNum}本
				</td>
				<td>
					${baseCard.cardBoredNum}本
				</td>
				<td>
					${baseCard.remarks}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>